perm filename A.TEX[MF,DEK]1 blob
sn#772304 filedate 1984-10-22 generic text, type T, neo UTF8
\ansno2.1:
Point $5=(100,0)$ is closer than any of the others. \ (See
the diagram below.)
\ansno2.2:
\decreasehsize 15pc
\rightfig A2a (13pc x 5pc) ↑9pt
False. But they all do have the same $y$~coordinate.
\ansno2.3:
5 units to the {\sl left\/} of the reference point, and 15 units up.
\ansno2.4:
\restorehsize $(200,-60)$.
\ansno2.5:
$"top"\,"lft"\,z↓1=(0,b)$; \ $"top"\,z↓2=(a,b)$; \
$"top"\,"rt"\,z↓3=(2a-1,b)$; \ $"bot"\,"lft"\,z↓4=(0,0)$; \
$"bot"\,z↓5=(a,0)$; \ $"bot"\,"rt"\,z↓6=(2a-1,0)$.
Adjacent characters will be separated by exactly one column of white
pixels, if character is $2a$ pixels wide, because the right edge of
black pixels is specified here to have the $x$~coordinate $2a-1$.
\ansno2.6:
$"right"=(1,0)$; $"left"=(-1,0)$; $"down"=(0,-1)$; $"up"=(0,1)$.
\ansno2.7:
True; this is $(2,3)-(5,-2)$.
\ansno2.8:
$0[z↓1,z↓2]=z↓1$, because we move none of the way towards~$z↓2$;
similarly $1[z↓1,z↓2]$ simplifies to~$z↓2$, because we move all of the
way. If we keep going in the same direction until we've gone twice as far
as the distance from $z↓1$ to~$z↓2$, we get to $2[z↓1,z↓2]$. But if we
start at point~$z↓1$ and face~$z↓2$, then back up exactly half the distance
between them, we wind up at $(-.5)[z↓1,z↓2]$.
\ansno2.9:
(a)~True; both are equal to $z↓1+{1\over2}(z↓2-z↓1)$.
(b)~False, but close; the right-hand side should be
${2\over3}z↓1+{1\over3}z↓2$. (c)~True; both are equal to $(1-t)z↓1+tz↓2$.
\ansno2.10:
There are several reasons. (1)~The equations in a \MF\ program
should represent the programmer's intentions as directly as possible;
it's hard to understand those intentions if you are shown only
their ultimate consequences, since it's not easy to reconstruct algebraic
manipulations that have gone on behind the scenes. (2)~It's easier and
safer to let the computer do algebraic calculations, rather than
to do them by hand. (3)~If the specifications for $z↓1$ and $z↓5$ change,
the formula $\bigl({1\over2}[x↓1,x↓5],b\bigr)$
still gives a reasonable value for~$z↓3$. It's
almost always good to anticipate the need for subsequent modifications.\par
However, the stated formula for $z↓3$ isn't the only reasonable way to
proceed. We could, for example, give two equations
\begindisplay
$x↓3-x↓1=x↓5-x↓3$;\qquad $y↓3=b$;
\enddisplay
the first of these states that the horizontal distance from 1 to 3 is
the same as the horizontal distance from 3 to~5. We'll see later that
\MF\ is able to solve a wide variety of equations.
\ansno2.11:
The following four equations suffice to define the four
unknown quantities $x↓2$, $y↓2$, $x↓4$, and $y↓4$:
$z↓4-z↓2="whatever"\times"angle"\,20$;
${1\over2}[y↓2,y↓4]={2\over3}[y↓3,y↓1]$;
$z↓2="whatever"[z↓1,z↓3]$;
$z↓4="whatever"[z↓3,z↓5]$. ↑↑"whatever" ↑↑{angle}
\ansno3.1:
The direction at $z↓2$ is parallel to the line $z↓4\to z↓3$, but
the vector $z↓4-z↓3$ specifies a direction towards $z↓4$, which is
$180↑\circ$ different from the direction $z↓3-z↓4$ that was discussed in
the text. Thus, we have a difficult specification to meet, and \MF\ draws
a pretzel-shaped curve that loops around in a way that's too ugly to show
here. The first part of the path, from $z↓4$ to $z↓2$, is mirror symmetric
about the line~$z1\to z5$ that bisects $z↓4\to z↓2$, so it starts out in a
south-by-southwesterly direction; the second part is mirror symmetric about
the vertical line that bisects $z↓2\to z↓3$, so when the curve ends at~$z↓3$
it's traveling roughly northwest. The moral is: Don't specify a direction
that runs opposite to (i.e., is the negative of) the one you really want.
\ansno3.2:
@draw@ $z↓5\to z↓4\{z↓4-z↓2\}\to z↓1\to z↓3\to z↓6\{z↓2-z↓6\}
\to"cycle"$.
\ansno4.1:
(a)~An ellipse $0.8\pt$ tall and $0.2\pt$ wide
(`$\,\vcenter{\hbox{\manual\nibc}}\,$');
\ (b)~A~circle of diameter $0.8\pt$ (rotation doesn't change a circle!);
\ (c)~same as~(a).
\ansno4.2:
Six individual points will be drawn, instead of lines or curves.
These points will be drawn with the current pen. However, for technical
reasons explained in Chapter~xx, the @draw@ command does its best work when it
is moving the pen; the pixels you get at the endpoints of curves are
not always what you would expect, especially at low resolutions. It is
usually best to say `↑@filldot@' instead of `@draw@' when you are drawing
only ↑{one point}.
\ansno4.3:
True, for all of the pens discussed so far. But false in general,
since we will see later that pens might extend further upward than
downward; i.e., $t$~might be unequal to~$b$ in the equations for
"top" and "bot".
\ansno4.4:
$x↓2=x↓1$; $x↓3={1\over2}[x↓2,x↓4]$; $x↓4=x↓5$; $"bot"\,y↓1=-o$;
$"top"\,y↓2=h+o$; $y↓4=y↓2$; $y↓5=y↓1$; @draw@ $z↓1\to z↓2$;
@draw@ $z↓2\to z↓3$; @draw@ $z↓3\to z↓4$; @draw@ $z↓4\to z↓5$.
We will learn later that the four @draw@ commands can be replaced by
\begindisplay
@draw@ $z↓1\dashto z↓2\dashto z↓3\dashto z↓4\dashto z↓5$;
\enddisplay
in fact, this will make \MF\ run slightly faster. ↑↑{--}
\ansno4.5:
Either say `@fill@ $z↓5\to z↓4\to z↓1\to z↓3\to z↓6\to z↓5\to
"cycle"$\!', or `@fill@ $z↓5\{\curl1\}\to z↓4\to z↓1\to z↓3\to z↓6\to
\{\curl1\}"cycle"$\!'. In the latter case you can omit either one of
the ↑{curl} specifications, but not both.
\ansno4.7:
${1\over2}\bigl["North",{1\over2}["North","West"]\bigr]=
{1\over2}\bigl[90,{1\over2}[90,180]\bigr]={1\over2}[90,135]=112.5$.
\ansno4.8:
$30↑\circ$, $60↑\circ$, $210↑\circ$, and $240↑\circ$. Since it's
possible to add or subtract $360↑\circ$ without changing the meaning,
the answers $-330↑\circ$, $-300↑\circ$, $-150↑\circ$, and $-120↑\circ$
are also correct.
\ansno4.9:
$z↓{1l}=(25,30)$, $z↓{1r}=(25,20)$.
\ansno4.10:
$dz↓1="up"$; $dz↓2="left"$; $dz↓3="down"$; $dz↓4="right"$.
These directions caused "penstroke" to expand into
\begindisplay
@fill@ $z↓{1r}\{"up"\}\to z↓{2r}\{"left"\}\to z↓{3r}\{"down"\}
\to z↓{4r}\{"right"\}\to"cycle"$;\cr
@unfill@ $z↓{1l}\{"up"\}\to z↓{2l}\{"left"\}\to z↓{3l}\{"down"\}
\to z↓{4l}\{"right"\}\to"cycle"$.\cr
\enddisplay
\ansno4.11:
We use angles ↑{perpendicular} to $(w,h)$ and $(w,-h)$ at the
diagonal endpoints:
\begindisplay
$x↓{1l}=x↓{4l}=0$; \ $x↓2=x↓5=.5w$; \ $x↓{3r}=x↓{6r}=w$;\cr
$y↓{1r}=y↓2=y↓{3l}=h$; \ $y↓{4r}=y↓5=y↓{6l}=0$; \ $z↓7=z↓8=.5[z↓1,z↓6]$;\cr
$z↓{1'}=.25[z↓1,z↓6]$; \ $z↓{6'}=.75[z↓1,z↓6]$; \ $d↓1:="argd"(w,-h)+90$;\cr
$z↓{3'}=.25[z↓3,z↓4]$; \ $z↓{4'}=.75[z↓3,z↓4]$; \ $d↓3:="argd"(-w,-h)+90$;\cr
$\penpos1(b,d↓1)$; \ $\penpos6(b,d↓1)$; \
$\penpos3(b,d↓3)$; \ $\penpos4(b,d↓3)$;\cr
$\penpos{1'}(b,d↓1)$; \ $\penpos{6'}(b,d↓1)$; \
$\penpos7(.6b,d↓1)$;\cr
$\penpos{3'}(b,d↓3)$; \ $\penpos{4'}(b,d↓3)$; \
$\penpos8(.6b,d↓3)$;\cr
$dz↓{1'}=dz↓{6'}=z↓{6'}-z↓{1'}$; \ $dz↓{3'}=dz↓{4'}=z↓{4'}-z↓{3'}$;\cr
$"penstroke"(1,1',7,6',6)$; \ $"penstroke"(3,3',8,4',4)$;\cr
$\penpos2(b,0)$; \ $\penpos5(b,0)$; \ $"penstroke"(2,5)$.\cr
\enddisplay
\ansno5.1:
The width is |0.8em#|, and an |em#| is 10 true points, so the
box will be exactly $8\pt$ wide in device-independent units. The
height will be $7\pt$. \ (And the depth below the baseline will be $0\pt$.)
\ansno5.2:
$8\times3.6=28.8$ rounds to the value $w=29$; similarly, $h=25$.
\ (And $d=0$.)
\ansno5.3:
It's merely necessary to supply the proper environment
by using "beginchar", etc., and by defining the appropriate
stem widths. We shouldn't use the names "thin" and "thick", which appear
already in the program for~O; the following solution assumes that the
``winning'' stem width for~I is $0.9\pt$:
\begintt
bar#:=.8pt#; stem#:=.9pt#; define_blacker_pixels(bar,stem);
beginchar("T",0.6em#,cap#,0); "The letter T";
penpos1(bar,75); penpos2(bar,72); penpos3(bar,70);
pentaper2(.4,.6); x1l=0; x2=.5w; x3=w;
y1=y3l; y2=.5[y1,y3]; .8[y2r,y3r]=h;
penpos4(10/9stem,argd(z3-z1)); z2=z4; pentaper4(.25,.1);
penpos5(10/9stem,20); penpos6(10/9stem,10);
x5r=x4r; y5=2/3h; x6=x5; y6=0; pentaper5(.4,0);
dz5=down; penstroke(1,2,3); penstroke(4,5,6);
penlabels(1,2,3,4,5,6); endchar;
\endtt
\ansno5.4:
Here's one way, using variables like "thick" and "bar"
that have already been defined in the~O or in the~T of the
\rightfig A5a ({200\apspix} x 252\apspix) ↑-61pt
previous exercise:
\begintt
beginchar("S",5/9em#,cap#,0); "The letter S";
penpos1(bar,70); penpos2(bar,80);
penpos3(.5[bar,thick],200); penpos5(.5[bar,thick],210);
penpos6(bar,80); penpos7(.25[bar,thick],75);
pentaper2(.4,.6); pentaper6(.3,.5);
x1=x5; y1r=.94h+o;
x2=x4=x6=.5w; y2r=h+o; y4=.54h; y6l=-o;
x3r=.04em; y3=.5[y4,y2];
x5l=w-.03em; y5=.5[y4,y6];
.5[x7l,x7]=.04em; y7l=.1h-o;
path trial; trial=z3{down}..z4..{down}z5;
dz4=direction 1 of trial;
penpos4(thick,argd(dz4)-90);
dz3=dz5=down; dz2=dz6=left;
penstroke(1,2,3,4,5,6,7);
penlabels(1,2,3,4,5,6,7); endchar;
\endtt
Notice that the pen angle at point 4 has been found by letting \MF\
↑↑"direction" construct a ↑{trial path} through the center points,
then using the ↑{perpendicular} direction. The letters work reasonably
well at their true size: `{\manual\IOI\IOO} {\manual\IOI\IOS}
{\manual\IOI\IOS\IOI\IOS} {\manual\IOT\IOO\IOO}; {\manual\IOT\IOO\IOS\IOS}
{\manual\IOI\IOT}, {\manual\IOO\IOT\IOI\IOS}.'
\ansno5.5:
After an ``isolated expression,'' \MF\ thinks it is at the end of
a statement or command, so it expects to see a semicolon next. You should
type, e.g., `|I;|~|mode_setup|' to keep \MF\ happy.
\ansno5.6:
Yes.